<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>错误日志 列表</title>
	<jsp:include page="../../import.jsp" flush="true"/>
</head>
<body class="iframeBody">
<div class="Wrapper">
	<div class="searchArea">
		<form id="searchBar">
			<div class="fieldset1 clearFix">
				<div class="FXBR">
					<div class="fieldBox">
						<div class="label">客户ID</div>
						<div class="field">
							<input name="cstId" id="cstId" type="text" class="ui-textbox" value="" ligerui="width: 160">
						</div>
					</div>
					<div class="fieldBox">
						<div class="label">用户ID</div>
						<div class="field">
							<input name="userId" id="userId" type="text" class="ui-textbox" value="" ligerui="width: 160">
						</div>
					</div>
					<div class="fieldBox">
						<div class="label">客户姓名</div>
						<div class="field">
							<input name="cstName" id="cstName" type="text" class="ui-textbox" value="" ligerui="width: 160">
						</div>
					</div>

				</div>
				<div class="FXBR">
					<div class="fieldBox">
						<div class="label">手机号</div>
						<div class="field">
							<input name="mobileNo" id="mobileNo" type="text" class="ui-textbox" value="" ligerui="width: 160">
						</div>
					</div>
					<div class="fieldBox">
						<div class="label">节点状态</div>
						<div class="field">
							<select name="logStatus" id="logStatus">
								<option value="">--全部--</option>
								<option value="1">成功</option>
								<option value="0">失败</option>
							</select>
						</div>
					</div>
					<div class="fieldBox ">
						<div class="label">查询时间</div>
						<div class="field">
							<input name="crtTmStart" id="crtTmStart" type="text" class="ui-datepicker" value="" ligerui="width: 115">
							至：
							<input name="crtTmEnd" id="crtTmEnd" type="text" class="ui-datepicker" value="" ligerui="width: 115">
						</div>
					</div>

				</div>
				<div class="clearFix"></div>
				<div class="btnsBox formBtns notRight">
					<span id="searchBtn" onclick="searchBtn();" class="sq-button-round">查询</span>
					<span id="clearBtn" onclick="clearBtn();" class="sq-button-round">清空</span>
					<input id="resetBtn" type="reset" value="重置" class="l-button l-button-reset Hide"/>
				</div>
			</div>
		</form>
	</div>
</div>
<div id="mcrLogTraceGrid" class="sq-grid"></div>
</div>

<script type="text/javascript">
	var grid = null;
	$(function () {
		initForm();
		initGrid();//注意初始化要在initForm之后,因为在初始化grid的时候需要form参数
		//initEvent();
	});

	//初始化表单
	function initForm(){
		$("#searchBar").ligerForm();
	}

	//查询按钮事件
	function searchBtn(){
		var form = new liger.get("searchBar");
		var data = form.getData();
		for (name in data){
			grid.setParm(name,data[name]);
		};
		grid.reload();
	}

	//查询参数
	function getSearchParams(){
		var form = new liger.get("searchBar");
		var data = form.getData();
		return data;
	}

	//初始化列表
	function initGrid(){
		$("#mcrLogTraceGrid").ligerGrid({
			url: '<%=path%>/mcr/mcrLogTrace/initList.do',
			method : 'post',
			isSingleCheck: false,
			parms:getSearchParams(),
			columns: [
				{ display: '创建时间', name: 'insTime', width: 120,render:renderDate,enabledSort:true},
				{ display: '客户ID', name: 'cstId', width: 120, enabledSort:true},
				{ display: '用户ID', name: 'userId', width: 120, enabledSort:true},
				{ display: '客户姓名', name: 'cstName', width: 120, enabledSort:true },
				{ display: '手机号', name: 'mobileNo', width: 120, enabledSort:true },
				{ display: '业务类型', name: 'userType', width: 120, enabledSort:true,
					render:function(rowData){
						if(rowData.userType=="0"){
							return "内部用户";
						}else if(rowData.userType=="1"){
							return "外部用户";
						}else if(rowData.userType=="2"){
							return "物流用户";
						}else{
							return "未知";
						}
					}
				},
				{ display: '进入方式', name: 'source', width: 120, enabledSort:true,
					render:function(rowData){
						if(rowData.source=="2"){
							return "RN";
						}else if(rowData.source=="4"){
							return "H5";
						}else{
							return "未知";
						}
					}
				},
				{ display: '节点', name: 'errorType', width: 120, enabledSort:true},
				{ display: '节点状态', name: 'logStatus', width: 120, enabledSort:true,
					render:function(rowData){
						if(rowData.logStatus==0){
							return "失败";
						}else if(rowData.logStatus==1){
							return "成功";
						}else{
							return "未知";
						}
					}

				},
				{ display: '原因', name: 'errorReason', width: 120, enabledSort:true},
				{	display: '流水号', name: 'reqNo', width: 120, enabledSort:true}
			],
			pageSize:10,
			root:'rows',
			record:'total',
			hideLoadButton : true,
			width: '100%',
			height:'100%',
			heightDiff:-2,
			checkbox:true,
			rownumbers:true
		});
		grid = liger.get("mcrLogTraceGrid");
		grid.setHeight(100);
	}



	//格式化时间
	function renderDate(rowdata, index, value){
		var dateStr = "";
		if(null != value){
			var date = new Date(value);
			dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DDHHMMSS);
		}
		return dateStr;
	}

	//清空按钮事件
	function clearBtn(){
		$("#resetBtn").click();  //重置 input-text
		var form = new liger.get("searchBar");
		form.setData({  //重置select等特殊表单
			"logStatus":""
		});
	}

	function iframeResize () {
		if (parent.mainApp) {
			parent.mainApp.parentTab.onResize();
		};
	}
</script>

</body>
</html>